import Vue from 'vue';
import App from './App';
import VueRouter from 'vue-router';
import VueResource from 'vue-resource';
import goods from 'components/goods/goods.vue';
import rating from 'components/ratings/ratings.vue';
import seller from 'components/seller/seller.vue';
import 'common/scss/index.scss';

Vue.use(VueRouter);
Vue.use(VueResource);
// 拦截请求，放入token
// Vue.http.interceptors.push(function (request, next) {
//   if (/['api']/.test(request.url)) {
//     request.headers.set('token', '123');
//   };
//   next();
// });

var router = new VueRouter({
  routes: [
    {
      path: '/goods',
      component: goods
    },
    {
      path: '/rating',
      component: rating
    },
    {
      path: '/seller',
      component: seller
    },
    {
      path: '*',
      component: goods
    }
  ],
  'linkActiveClass': 'active'
});
router.push({path: '/goods'});
router.afterEach(function(router) {
});
/* eslint-disable no-new */
new Vue({
  el: '#app',
  'router': router,
  template: '<App/>',
  components: {
    App
  }
});

